package main

import (
	"flag"
	"fmt"
	"gitee.com/gam6it/SecToolkit/chaitin/xray"
	"log"
)

func main() {
	var u, ei, token string
	var pi, planId int
	flag.StringVar(&u, "url", "", "Xray URL地址")
	flag.StringVar(&ei, "ei", "", "引擎ID")
	flag.StringVar(&token, "token", "", "Token")
	flag.IntVar(&pi, "pi", 1, "Project ID")
	flag.IntVar(&planId, "ti", 1, "Plan ID")
	flag.Parse()
	if ei == "" || u == "" || token == "" {
		log.Fatalf("输入不能为空！\n")
	}
	client := xray.Client{
		ProjectId: pi,
		URI:       u,
		Token:     token,
		Engines: []xray.Engine{
			{
				Id:   ei,
				Addr: "",
			},
		},
	}
	plan, _ := client.Plan(planId)
	fmt.Println(plan.XProcess)
	fmt.Println(plan.LatestAliveHosts())
}
